package com.tarena.lbs.user.rpc;

import com.tarena.lbs.user.api.UserApi;
import com.tarena.lbs.user.api.pojo.dto.AdminDto;
import com.tarena.lbs.user.api.pojo.dto.UserDto;
import com.tarena.lbs.user.service.impl.AdminServiceImpl;
import com.tarena.lbs.user.service.impl.UserServiceImpl;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;


@Slf4j
@Service
@DubboService
@RequiredArgsConstructor
public class UserApiImpl implements UserApi {

    private final AdminServiceImpl adminService;

    private final UserServiceImpl userService;

    @Override
    public List<Integer> getUserGroupIds(Integer userId, Integer businessId) {
        return userService.getGroupIds(userId,businessId);
    }

    @Override
    public AdminDto getAdminById(Integer adminId) {
        return adminService.detail(adminId);
    }

    @Override
    public UserDto getUserById(Integer userId) {
        return userService.detail(userId);
    }
}
